﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ThreadLearn
{
    internal static class DelayDemo
    {
        public static void Index()
        {
            Console.WriteLine("Checking status every 2 seconds 1990");
            Status();
            Console.ReadLine();
        }

        public static async void Status()
        {
            while(true)
            {
                Console.WriteLine("In state at {0}", DateTime.Now);
                await Task.Delay(2000);

            }
        }

        public static void Index1()
        {
            Console.WriteLine("begin date=>" + DateTime.Now);
            Task task1 = Task.Delay(2000);
            task1.Test("exec extend func date=>"+DateTime.Now);
            task1.ContinueWith(t => Console.WriteLine("continct date=>" + DateTime.Now));
        }

        public static void Test(this Task tast, string value)
        {
            Console.WriteLine("value=>" + value);
            //abc test
        }

    }
}
